Crate oddio[−][src]
Expand description
Lightweight game audio
let (mut scene_handle, scene) = oddio::split(oddio::SpatialScene::new(sample_rate, 0.1));
// In audio callback:
let out_frames = oddio::frame_stereo(data);
oddio::run(&scene, output_sample_rate, out_frames);
// In game logic:
let frames = oddio::FramesSignal::from(oddio::Frames::from_slice(sample_rate, &frames));
let mut handle = scene_handle.control::<oddio::SpatialScene, _>()
.play(frames, oddio::SpatialOptions { position, velocity, ..Default::default() });
// When position/velocity changes:
handle.control::<oddio::Spatial<_>, _>().set_motion(position, velocity, false);To get started, review the examples
subdirectory in the crate source.
Key primitives:
Framesstores static audio data, which can be played with aFramesSignalMixerallows multiple signals to be played concurrently and controlled during playbackSpatialSceneis a mixer that spatializes its signalsHandleallows control of a signal while it’s playing, from a mixer orsplitrunwrites frames from aSignalinto an output buffer
Structs
Smoothly adjusts gain over time to keep average (RMS) signal level within a target range
Configuration for an Adapt filter, passed to Adapt::new
A constant signal, useful for testing
Sums all channels together
A sequence of static audio frames at a particular sample rate
An audio signal backed by a static sequence of samples
Thread-safe control for a FramesSignal, giving access to current playback location.
Amplifies a signal
Thread-safe control for a Gain filter
Handle for manipulating a signal owned elsewhere
Index value for FilterHaving representing the first filter in the chain
Handle for controlling a Mixer from another thread
Adapts a mono signal to output stereo by duplicating its output
Smoothly maps a signal of any range into (-1, 1)
Helper to linearly ramp a parameter towards a target value
An individual seekable spatialized signal
An individual buffered spatialized signal
Control for updating the motion of a spatial signal
Passed to SpatialSceneControl::play
Signal for stereo output from a spatial scene
Control for modifying a SpatialScene
Scales rate of playback by a dynamically-adjustable factor
Thread-safe control for a Speed filter
A concurrently controlled Signal
A source that can be paused or permanently stopped
Thread-safe control for a Stop filter
Dynamic audio from an external source
Thread-safe control for a Stream
SPSC queue that only retains the last element sent
Smoothly maps a signal of any range into (-1, 1)
Index value for FilterHaving representing the filter at position T+1
Traits
A Signal or transformer that can be safely controlled from another thread
Filter chains that contain a T at any position
A single frame of audio data, encoding one sample for each channel
Types that can be linearly interpolated, for use with Smoothed
Audio signals which support seeking
An audio signal
Functions
Convert a slice of interleaved stereo data into a slice of stereo frames
Populate out with frames from signal at sample_rate
Split concurrent controls out of a signal
Type Definitions
Unitless instantaneous sound wave amplitude measurement
